import request from '@/utils/request'
import MD5 from 'md5.js'

export function login (username, password,user_type) {
  var reqObj = {username,user_type,password}
  // reqObj.password = new MD5().update(username + password).digest('hex')
  return request({
    url: '/user/login',
    method: 'post',
    data: reqObj
  })
}

export function logout () {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function modify (id,oldPassword,newPassword) {
  var reqObj = {id,oldPassword,newPassword}
  return request({
    url: '/user/savePasswordModify',
    method: 'post',
    data: reqObj
  })
}

export function userMenu (role_id) {
  var reqObj = {role_id}
  return request({
    // url: '/role/menu/list',
    url: '/role/router/list',
    method: 'get',
    data: reqObj
  })
}